<template>
  <!-- 销售统计 -->
  <div class="box home-sku-sale-stats bgc2">
    <div class="header">
      <div class="title">销售统计
        <span class="sub-title">{{ monthStart }} ~ {{ monthEnd }}</span>
      </div>
    </div>
    <div class="body">
      <div class="stats">
        <div class="item">
          <div class="num color3 text-shadow2">{{ count }}</div>
          <div class="text color4">订单量（个）</div>
        </div>
      </div>
      <div class="stats">
        <div class="item">
          <div class="num color3 text-shadow2">{{ amount }}</div>
          <div class="text color4">销售额（万元）</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getOrderCountAPI, getOrderAmountAPI } from '@/api/reconciliation'
import { monthStart, monthEnd, monthDetailStart, monthDetailEnd } from '@/utils/dayjs'
export default {
  name: '',
  components: {},
  props: {},
  data() {
    return {
      count: 0,
      amount: 0,
      monthStart,
      monthEnd
    }
  },
  computed: {},
  watch: {},
  created() {
    this.orderCount()
    this.orderAmount()
  },
  methods: {
    async orderCount() {
      const { data } = await getOrderCountAPI({
        start: monthDetailStart,
        end: monthDetailEnd })
      this.count = data
    },
    async orderAmount() {
      const { data } = await getOrderAmountAPI({
        start: monthDetailStart,
        end: monthDetailEnd })
      this.amount = (data / 1000000).toFixed(2)
    }
  }
}
</script>
<style scoped lang='scss'>
@import "~@/styles/home.scss";
</style>
